package com.tanhua.autoconfig.properties;

import com.baidu.aip.face.AipFace;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

@Data
@ConfigurationProperties(prefix = "tanhua.aipface")
public class AipfaceProperties {

    @Autowired
    private Environment environment;
    private String APP_ID;
    private String API_KEY;
    private String SERET_KEY;

    @Bean
    public AipFace aipFace() {
        System.out.println(environment.getProperty("tanhua.aipface.APP_ID"));
        AipFace client = new AipFace(environment.getProperty("tanhua.aipface.APP_ID"), environment.getProperty("tanhua.aipface.API_KEY"), environment.getProperty("Stanhua.aipface.ERET_KEY"));
        // 可选：设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);
        return client;
    }
}
